package com.monkeygroup.mygoplus.view.home.activity.person;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;

import com.monkeygroup.mygoplus.R;
import com.monkeygroup.mygoplus.base.BaseActivity;
import com.monkeygroup.mygoplus.commit.thing.vo.PropertyCommitVO;
import com.monkeygroup.mygoplus.common.DefinedView.CustomTextWatcher;
import com.monkeygroup.mygoplus.common.DefinedView.IdentifyTextWatcher;
import com.monkeygroup.mygoplus.common.DefinedView.MyAlertDialog;
import com.monkeygroup.mygoplus.common.DefinedView.PickerView;
import com.monkeygroup.mygoplus.common.utils.LocalInfo;
import com.monkeygroup.mygoplus.common.utils.StringUtil;
import com.monkeygroup.mygoplus.http.HttpModel;
import com.monkeygroup.mygoplus.http.PersonHttpModel;
import com.monkeygroup.mygoplus.http.RequestUrl;
import com.monkeygroup.mygoplus.user.vo.IdentifyVO;
import com.monkeygroup.mygoplus.user.vo.PersonalNomalInfo;
import com.monkeygroup.mygoplus.view.home.activity.PublishedChooseAddrActivity;
import com.monkeygroup.mygoplus.view.home.activity.ThingsDetailActivity;
import com.monkeygroup.mygoplus.view.home.activity.sell.PublishedActivity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * Created by cumt on 2017/6/19.
 */

public class ApplyIdentifyActivity extends BaseActivity implements View.OnClickListener {

    public static void gotoActivity(Activity activity,String parent,int type) {
        Intent intent = new Intent(activity,
                ApplyIdentifyActivity.class);
        intent.putExtra("type",type);
        intent.putExtra("parent",parent);

        activity.startActivity(intent);
    }

    private Activity activity;
    private ImageView imgBack;
    private TextView txtTitle;

    private EditText et_account,et_pwd,et_first_name,et_user_name,et_nick_name,et_sex;
    private EditText et_tel,et_my_tel,et_addr,et_alley,et_lane,et_gate,et_storey,et_offices;

    private TextView spinner_month_price,spinner_company,spinner_agent_no;
    private CheckBox check_tel,check_fixed_tel;

    private EditText et_first_service_area,et_second_service_area,et_shop_name;

    private CheckBox check_redirect_shop,check_join_shop,check_other;

    private EditText et_email,et_agent_no,et_sellprice,et_company_addr,et_alley_I,et_lane_I,et_gate_I,et_storey_I,et_offices_I,et_community;
    private TextView txt_tel,txt_phone;
    private LinearLayout ll_bottom_see;

    private PopupWindow pickerpop;
    private PickerView picker;

    private IdentifyVO requestVO;
    private int type;
    private String parent;

    //請求參數
    private Map<String, String> params;
    private PersonHttpModel personHttpModel;

    @Override
    public void onClick(View v) {

    }

    @Override
    public void setContentView() {
        setContentView(R.layout.apply_identify);

    }

    @Override
    public void initView() {

        activity = ApplyIdentifyActivity.this;

        imgBack = (ImageView) findViewById(R.id.img_back);
        txtTitle = (TextView) findViewById(R.id.txt_title);

//        requestVO=new IdentifyVO();

        et_account= (EditText) findViewById(R.id.et_account);
        et_pwd= (EditText) findViewById(R.id.et_pwd);
        et_first_name= (EditText) findViewById(R.id.et_first_name);
        et_user_name= (EditText) findViewById(R.id.et_user_name);
        et_nick_name= (EditText) findViewById(R.id.et_nick_name);
        et_sex= (EditText) findViewById(R.id.et_sex);

        et_tel= (EditText) findViewById(R.id.et_tel);
        et_email= (EditText) findViewById(R.id.et_email);
        et_my_tel= (EditText) findViewById(R.id.et_my_tel);
        et_addr= (EditText) findViewById(R.id.et_addr);

        et_alley= (EditText) findViewById(R.id.et_alley);
        et_lane= (EditText) findViewById(R.id.et_lane);
        et_gate= (EditText) findViewById(R.id.et_gate);
        et_storey= (EditText) findViewById(R.id.et_storey);
        et_offices= (EditText) findViewById(R.id.et_offices);


        spinner_month_price= (TextView) findViewById(R.id.spinner_month_price);

        check_tel= (CheckBox) findViewById(R.id.check_tel);
        check_fixed_tel= (CheckBox) findViewById(R.id.check_fixed_tel);


        et_first_service_area= (EditText) findViewById(R.id.et_first_service_area);
        et_second_service_area= (EditText) findViewById(R.id.et_second_service_area);

        spinner_company= (TextView) findViewById(R.id.spinner_company);

        et_shop_name= (EditText) findViewById(R.id.et_shop_name);

        check_redirect_shop= (CheckBox) findViewById(R.id.check_redirect_shop);
        check_join_shop= (CheckBox) findViewById(R.id.check_join_shop);
        check_other= (CheckBox) findViewById(R.id.check_other);

        txt_tel= (TextView) findViewById(R.id.txt_tel);
        txt_phone= (TextView) findViewById(R.id.txt_phone);

        et_agent_no= (EditText) findViewById(R.id.et_agent_no);

        spinner_agent_no= (TextView) findViewById(R.id.spinner_agent_no);

        et_sellprice= (EditText) findViewById(R.id.et_sellprice);

        et_company_addr= (EditText) findViewById(R.id.et_company_addr);
        et_alley_I= (EditText) findViewById(R.id.et_alley);
        et_lane_I= (EditText) findViewById(R.id.et_alley_I);
        et_gate_I= (EditText) findViewById(R.id.et_gate_I);
        et_storey_I= (EditText) findViewById(R.id.et_storey_I);
        et_offices_I= (EditText) findViewById(R.id.et_offices_I);

        ll_bottom_see= (LinearLayout) findViewById(R.id.ll_bottom_see);
        et_community= (EditText) findViewById(R.id.et_community);

        Intent intent = this.getIntent();
        Bundle bundle =  intent.getExtras();
        type = bundle.getInt("type");
        parent = bundle.getString("parent");


        fillData();
        initWatcher();
        initPickerPopwindow();

        params = new HashMap<>();
        initRequest();

    }


    private void fillData(){


        IdentifyVO vo = new IdentifyVO();
        if("0".equals(parent)){
            vo.setFlag(2);
            vo.setChild_flag(2);

            txtTitle.setText("營業員/經紀人");



        }
        else if("1".equals(parent)){
            vo.setFlag(11);
            vo.setChild_flag(type);
            txtTitle.setText("專家");



        }
        else if("2".equals(parent)){
            vo.setFlag(10);
            vo.setChild_flag(type);
            txtTitle.setText("企業品牌");


        }
        Log.e("requestVO.ge11()==",""+vo.getChild_flag());
        requestVO= LocalInfo.getIdentify(activity,vo);
        requestVO.setFlag(vo.getFlag());
        requestVO.setChild_flag(vo.getChild_flag());
        Log.e("requestVO.ge()==",""+requestVO.getAccount());
        et_account.setText(requestVO.getAccount());
        et_pwd.setText(requestVO.getPasswd());
        et_first_name.setText(requestVO.getFirstname());
        et_user_name.setText(requestVO.getLastname());
        et_nick_name.setText(requestVO.getName());
 //       et_sex.setText(String.valueOf(requestVO.getGender()));
        et_tel.setText(requestVO.getMobile());
//        et_my_tel.setText(requestVO.getAccount());
        et_addr.setText(requestVO.getAddr());
        et_alley.setText(requestVO.getAlley());
//        et_lane.setText(requestVO.getAccount());
        et_gate.setText(requestVO.getGate());
//        et_storey.setText(requestVO.getAccount());
//        et_offices.setText(requestVO.getAccount());
        et_first_service_area.setText(String.valueOf(requestVO.getServer_addr_I()));
        et_second_service_area.setText(String.valueOf(requestVO.getServer_addr_II()));
        et_shop_name.setText(requestVO.getShopname());
        et_agent_no.setText(requestVO.getCerti1());
//        et_sellprice.setText(requestVO.getAccount());
        et_company_addr.setText(requestVO.getCompanyaddr());
        et_alley_I.setText(requestVO.getCom_alley());
//        et_lane_I.setText(requestVO.getAccount());
        et_gate_I.setText(requestVO.getCom_gate());
        et_storey_I.setText(requestVO.getCom_gate());
        et_offices_I.setText(requestVO.getCom_room());
        et_community.setText(requestVO.getCommunityname());
        et_email.setText(requestVO.getEmail());

        if(requestVO.getGender()==1){
            et_sex.setText("男");
        }
        else{
            et_sex.setText("女");
        }
        spinner_company.setText(requestVO.getBrandname());
        if(requestVO.getShoptype()==1){
            check_redirect_shop.setChecked(true);
        }
        else if(requestVO.getShoptype()==2){
            check_join_shop.setChecked(true);
        }
        else{
            check_other.setChecked(true);

        }


    }

    private void initWatcher(){
        Log.e("identifild_flag2222()=",""+requestVO.getFlag()+requestVO.getChild_flag());
        et_account.addTextChangedListener(new IdentifyTextWatcher(activity,et_account,requestVO,1));
        et_pwd.addTextChangedListener(new IdentifyTextWatcher(activity,et_pwd,requestVO,2));
        et_first_name.addTextChangedListener(new IdentifyTextWatcher(activity,et_first_name,requestVO,3));
        et_user_name.addTextChangedListener(new IdentifyTextWatcher(activity,et_user_name,requestVO,4));
        et_nick_name.addTextChangedListener(new IdentifyTextWatcher(activity,et_nick_name,requestVO,5));
        et_sex.addTextChangedListener(new IdentifyTextWatcher(activity,et_sex,requestVO,6));
        et_tel.addTextChangedListener(new IdentifyTextWatcher(activity,et_tel,requestVO,7));
        et_my_tel.addTextChangedListener(new IdentifyTextWatcher(activity,et_my_tel,requestVO,8));
        et_addr.addTextChangedListener(new IdentifyTextWatcher(activity,et_addr,requestVO,9));
        et_alley.addTextChangedListener(new IdentifyTextWatcher(activity,et_alley,requestVO,10));
        et_lane.addTextChangedListener(new IdentifyTextWatcher(activity,et_lane,requestVO,11));
        et_gate.addTextChangedListener(new IdentifyTextWatcher(activity,et_gate,requestVO,12));
        et_storey.addTextChangedListener(new IdentifyTextWatcher(activity,et_storey,requestVO,13));
        et_offices.addTextChangedListener(new IdentifyTextWatcher(activity,et_offices,requestVO,14));
        et_first_service_area.addTextChangedListener(new IdentifyTextWatcher(activity,et_first_service_area,requestVO,15));
        et_second_service_area.addTextChangedListener(new IdentifyTextWatcher(activity,et_second_service_area,requestVO,16));
        et_shop_name.addTextChangedListener(new IdentifyTextWatcher(activity,et_shop_name,requestVO,17));
        et_agent_no.addTextChangedListener(new IdentifyTextWatcher(activity,et_agent_no,requestVO,18));
        et_sellprice.addTextChangedListener(new IdentifyTextWatcher(activity,et_sellprice,requestVO,19));
        et_company_addr.addTextChangedListener(new IdentifyTextWatcher(activity,et_company_addr,requestVO,20));
        et_alley_I.addTextChangedListener(new IdentifyTextWatcher(activity,et_alley_I,requestVO,21));
        et_lane_I.addTextChangedListener(new IdentifyTextWatcher(activity,et_lane_I,requestVO,22));
        et_gate_I.addTextChangedListener(new IdentifyTextWatcher(activity,et_gate_I,requestVO,23));
        et_storey_I.addTextChangedListener(new IdentifyTextWatcher(activity,et_storey_I,requestVO,24));
        et_offices_I.addTextChangedListener(new IdentifyTextWatcher(activity,et_offices_I,requestVO,25));
        et_community.addTextChangedListener(new IdentifyTextWatcher(activity,et_community,requestVO,26));
        et_email.addTextChangedListener(new IdentifyTextWatcher(activity,et_email,requestVO,27));
    }



    @Override
    public void setListener() {

        check_tel.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    check_fixed_tel.setChecked(false);
                    //   requestVO.setProperty_completedate(spinner_room_age.getText());
                  txt_tel.setTextColor(getResources().getColor(R.color.bottom_gray));
                  txt_phone.setTextColor(getResources().getColor(R.color.font_gray_IV));
                }
            }
        });
        check_fixed_tel.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    check_tel.setChecked(false);
                    //   requestVO.setProperty_completedate(spinner_room_age.getText());
                    txt_tel.setTextColor(getResources().getColor(R.color.font_gray_IV));
                    txt_phone.setTextColor(getResources().getColor(R.color.bottom_gray));

                }
            }
        });
        check_redirect_shop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    check_join_shop.setChecked(false);
                    check_other.setChecked(false);
                    //   requestVO.setProperty_completedate(spinner_room_age.getText());

                }
            }
        });

        check_join_shop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    check_redirect_shop.setChecked(false);
                    check_other.setChecked(false);
                    //   requestVO.setProperty_completedate(spinner_room_age.getText());

                }
            }
        });

        check_other.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked){
                    check_redirect_shop.setChecked(false);
                    check_join_shop.setChecked(false);
                    //   requestVO.setProperty_completedate(spinner_room_age.getText());

                }
            }
        });



    }

    @Override
    public void doEvent() {


        et_sex.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                List<String> datas = new ArrayList<String>();
                datas.add("男");
                datas.add("女");
                picker.setData(datas);

                picker.setOnSelectListener(new PickerView.onSelectListener() {
                    @Override
                    public void onSelect(String text) {
                        et_sex.setText(text);
                        if("男".equals(text)){
                            requestVO.setGender(1);
                        }
                        else if("女".equals(text)){
                            requestVO.setGender(0);
                        }

                    }
                });

                if (pickerpop != null && pickerpop.isShowing()) {
                    pickerpop.dismiss();
                } else {
                    pickerpop.showAtLocation(getCurrentFocus(), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                }

            }
        });

        spinner_company.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                List<String> datas = new ArrayList<String>();
                fillCompany(datas);
                picker.setData(datas);

                picker.setOnSelectListener(new PickerView.onSelectListener() {
                    @Override
                    public void onSelect(String text) {
                        spinner_company.setText(text);
                        requestVO.setBrandname(text);

                    }
                });

                if (pickerpop != null && pickerpop.isShowing()) {
                    pickerpop.dismiss();
                } else {
                    pickerpop.showAtLocation(getCurrentFocus(), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                }

            }
        });

        spinner_agent_no.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                List<String> datas = new ArrayList<String>();
                fillAddr(datas);
                picker.setData(datas);

                picker.setOnSelectListener(new PickerView.onSelectListener() {
                    @Override
                    public void onSelect(String text) {
                        spinner_agent_no.setText(text);


                    }
                });

                if (pickerpop != null && pickerpop.isShowing()) {
                    pickerpop.dismiss();
                } else {
                    pickerpop.showAtLocation(getCurrentFocus(), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
                }

            }
        });

        et_addr.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PublishedChooseAddrActivity.gotoActivity(activity,"5");

            }
        });

        et_company_addr.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PublishedChooseAddrActivity.gotoActivity(activity,"2");

            }
        });

        et_first_service_area.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PublishedChooseAddrActivity.gotoActivity(activity,"3");

            }
        });


        et_second_service_area.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PublishedChooseAddrActivity.gotoActivity(activity,"4");

            }
        });

        ll_bottom_see.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Boolean notice=false;
                if(StringUtil.isBlank(requestVO.getAccount())){
                    notice=true;
                    setFocus(et_account,notice);
                }
                if(StringUtil.isBlank(requestVO.getPasswd())){
                    notice=true;
                    setFocus(et_pwd,notice);
                }
                if(StringUtil.isBlank(requestVO.getFirstname())){
                    notice=true;
                    setFocus(et_first_name,notice);
                }
                if(StringUtil.isBlank(requestVO.getLastname())){
                    notice=true;
                    setFocus(et_user_name,notice);
                }
                if(StringUtil.isBlank(requestVO.getName())){
                    notice=true;
                    setFocus(et_nick_name,notice);
                }

                if(StringUtil.isBlank(requestVO.getMobile())){
                    notice=true;
                    setFocus(et_tel,notice);
                }


                if(StringUtil.isBlank(String.valueOf(requestVO.getServer_addr1()))){
                //    notice=true;
                 //   setFocus(et_first_service_area,notice);
                }
                if(StringUtil.isBlank(String.valueOf(requestVO.getBrandname()))){
                   // notice=true;
//                    setFocus(spinner_company,notice);
                }
                if(StringUtil.isBlank(String.valueOf(requestVO.getShopname()))){
                    notice=true;
                    setFocus(et_shop_name,notice);
                }

                if(notice){

                    MyAlertDialog dialog = new MyAlertDialog(activity,"您尚未填寫完畢",String.valueOf(et_account.getText()));
                    dialog.show(activity,"您尚未填寫完畢",1);
                }
                else{

                    params = requestVO.toMap(params);

                    personHttpModel.requestUserInfo();
                }



            }
        });


    }

    private static void setFocus(EditText edit,boolean notice){

        notice=true;
        edit.requestFocus();
        InputMethodManager imm=(InputMethodManager)edit.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

        imm.toggleSoftInput(0,InputMethodManager.SHOW_FORCED);


    }

    private void fillCompany(List<String> datas){

        datas.add("21世紀不動產");
        datas.add("太平洋房屋");
        datas.add("中信房屋");
        datas.add("台灣房屋");
        datas.add("全國不動產");
        datas.add("永春不動產");
        datas.add("永慶不動產");
        datas.add("永慶房屋");
        datas.add("有巢氏房屋");
        datas.add("住商不動產");
        datas.add("東森房屋");
        datas.add("東龍不動產");
        datas.add("信義房屋");
        datas.add("美商ERA不動產");
        datas.add("惠雙不動產");
        datas.add("群義不動產");
        datas.add("群森房屋");
        datas.add("僑福房屋");
        datas.add("僑茂不動產");
        datas.add("鯨魚租屋");
        datas.add("其他");


    }

    private void fillAddr(List<String> datas){
        datas.add("北市經證");
        datas.add("中市");
        datas.add("基市");
        datas.add("南市");
        datas.add("高市");
        datas.add("新北經");
        datas.add("北縣");
        datas.add("宜");
        datas.add("桃縣");
        datas.add("嘉市");
        datas.add("竹縣地經");
        datas.add("苗縣地登");
        datas.add("中縣");
        datas.add("投縣");
        datas.add("彰縣");
        datas.add("竹市");
        datas.add("雲縣地");
        datas.add("嘉縣");
        datas.add("南縣");
        datas.add("高縣");
        datas.add("屏縣");
        datas.add("花縣");
        datas.add("東經人");
        datas.add("金縣");
        datas.add("澎縣經證");
        datas.add("澎府地行");
        datas.add("連縣");

    }

    private void  fillTel(List<String> datas){
        datas.add("02");
        datas.add("03");
        datas.add("037");
        datas.add("038");
        datas.add("039");
        datas.add("04");
        datas.add("049");
        datas.add("05");
        datas.add("06");
        datas.add("07");
        datas.add("08");
        datas.add("089");
        datas.add("0823");
        datas.add("0826");
        datas.add("0827");
        datas.add("0836");

    }

    private void initRequest(){



        personHttpModel = new PersonHttpModel(RequestUrl.saveuerUrl,params,new PersonHttpModel.SimpleOnHttpRequestListener(){


            @Override
            public void onRequestFinished(String resultCode, Integer timestamp) {

            }

            @Override
            public void onRequestFinished(String resultCode, int seq, int isbind, String acc) {

                Log.e("resultCoderesultCode===",""+resultCode);
                //請求成功
                if("ERROR_OK".equals(resultCode)){

                    Toast.makeText(activity, seq+"注册成功",
                            Toast.LENGTH_SHORT).show();
                    PersonalNomalInfo user = LocalInfo.getUserInfo(activity);
                    user.setPassword(String.valueOf(et_pwd.getText()));
                    user.setAccount(String.valueOf(et_account.getText()));
                    user.setSeq(seq);
                    LocalInfo.saveUserInfo(activity,user);


                }
                else{

                    Toast.makeText(activity, resultCode,
                            Toast.LENGTH_SHORT).show();
                }
            }

            @Override
            public void onRequestFinished(String resultCode, int seq, int flag, String flag_name, int secflag, String secflag_name) {

            }

        },true);



    }

    private void initPickerPopwindow(){

        LayoutInflater myinflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View contentView=myinflater.inflate(R.layout.popwindow_picker, null);




        pickerpop = new PopupWindow(contentView,
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, true);

        pickerpop.setTouchable(true);


        picker= (PickerView)contentView.findViewById(R.id.choose_picker);
        LinearLayout  ll_picker= (LinearLayout)contentView.findViewById(R.id.ll_picker);
        ll_picker.setVisibility(View.GONE);


        //  ColorDrawable dw = new ColorDrawable(getResources().getColor(R.color.backgroud_light_I));
        pickerpop.setBackgroundDrawable(new BitmapDrawable());

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if(requestCode==11&&data!=null){

             String mytype = data.getStringExtra("type");
            String city = data.getStringExtra("property_city");
            String cityId = data.getStringExtra("property_city_id");
            String area = data.getStringExtra("property_area");
            String areaId = data.getStringExtra("property_area_id");
            String street = data.getStringExtra("property_street");
            String streetId = data.getStringExtra("property_street_id");
            //居住地址
            if("5".equals(mytype)){

                et_addr.setText(city+area+street);
                if(requestVO==null){
                    requestVO=new IdentifyVO();
                }
                Log.e("streetIdstreetI===",""+cityId);
                if(!StringUtil.isBlank(cityId)){
                    requestVO.setCity(Integer.parseInt(cityId));
                }
                if(!StringUtil.isBlank(areaId)){
                    requestVO.setArea(Integer.parseInt(areaId));
                }


            }
            else if("2".equals(mytype)){
                et_company_addr.setText(city+area+street);
                if(requestVO==null){
                    requestVO=new IdentifyVO();
                }
                Log.e("streetIdstreetI===",""+cityId);
                if(!StringUtil.isBlank(cityId)){
                    requestVO.setComcity(Integer.parseInt(cityId));
                }
                if(!StringUtil.isBlank(areaId)){
                    requestVO.setComarea(Integer.parseInt(areaId));
                }
                if(!StringUtil.isBlank(streetId)){
                  //  requestVO.setComstreet(Integer.parseInt(streetId));
                }

            }
            else if("3".equals(mytype)){
                et_first_service_area.setText(city+area);
                requestVO.setServer_addr1(Integer.parseInt(areaId));
                requestVO.setServer_addr_I(area);
            }
            else if("4".equals(mytype)){
                et_second_service_area.setText(city+area);
                requestVO.setServer_addr2(Integer.parseInt(areaId));
                requestVO.setServer_addr_II(area);
            }

            LocalInfo.saveIdentify(activity,requestVO);
        }

    }

}
